UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IIgoH/kMEDS3+A5JvWLTipGQ+JRtcNq8sPWeuoLHNR0=' 
WHERE 
  key_id = '064c76dd3418f1184899813e377cae4714e4186c5edf29d2bb04c3e06fecf387' 
  AND (
    token = 'IIgoH/kMEDS3+A5JvWLTipGQ+JRtcNq8sPWeuoLHNR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032