UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O2wSyX2OZUFbJakveUDHwSyiGZce9Gl1KPMuzRMvHWM=' 
WHERE 
  key_id = '1cefdc29dd09b6ceecd306c4d5faf2f2ccf6d913ca14782feec26a0e65d124e8' 
  AND (
    token = 'O2wSyX2OZUFbJakveUDHwSyiGZce9Gl1KPMuzRMvHWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036