UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bpqGyIy7WTogT2QJOQ1MKED+2Y6jzpimLEynYeNGXhg=' 
WHERE 
  key_id = 'b078630bd596eb75ba66c622d82c416aaba376540e5845c7297c096ed7571750' 
  AND (
    token = 'bpqGyIy7WTogT2QJOQ1MKED+2Y6jzpimLEynYeNGXhg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047