UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ln9IyPWme2D1prmwxdJcvWRMuf7nZA4LxSRuFOIbCGM=' 
WHERE 
  key_id = '224c5314c0b11dbcb8eb4a983e8020b13e343287171de4556b3099b9f9f61555' 
  AND (
    token = 'Ln9IyPWme2D1prmwxdJcvWRMuf7nZA4LxSRuFOIbCGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032