UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6ZgBP5ke3OHub/1U22m6UmalZO4l67VvLQoX0nVq8zM=' 
WHERE 
  key_id = 'ea79c765c4b1624946e77d737e4e328c745b011d2c289055f986dd7b16236512' 
  AND (
    token = '6ZgBP5ke3OHub/1U22m6UmalZO4l67VvLQoX0nVq8zM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034