UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4NvXJYjgHdYhaaz1bFkuYAFpNeckKQyCOI3j+V4+kM=' 
WHERE 
  key_id = '545fe4f21e6cab029da70023c5c7e37268b945cf6762c1b5a8c0b7e62f822ad9' 
  AND (
    token = 'V4NvXJYjgHdYhaaz1bFkuYAFpNeckKQyCOI3j+V4+kM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024