UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gLr52XlAqS8XfPeGnFJwou/v3PnCklWsqcev+9C0Hko=' 
WHERE 
  key_id = 'dc0e38733d7cb6b630f801d02fe2cfcab2cd0db51806e2248f3af758169fc9f6' 
  AND (
    token = 'gLr52XlAqS8XfPeGnFJwou/v3PnCklWsqcev+9C0Hko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025