UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jz5JV8/UG2IIzVYwsj3Pb06d0oAVkYOgjsuwwiBrcHs=' 
WHERE 
  key_id = '94e4161dc329e9904d50f9a8e39cdf378ff2e226ae9dc96db200ae1684a2c16f' 
  AND (
    token = 'jz5JV8/UG2IIzVYwsj3Pb06d0oAVkYOgjsuwwiBrcHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034