UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XWvClf36QslHpZRlVT1UH3wPgX6ohMS2wJXSeOBc4YE=' 
WHERE 
  key_id = 'ed7951a888a6c98d144f8178c17444b18e1832f439f4fe415abe9000f8893e80' 
  AND (
    token = 'XWvClf36QslHpZRlVT1UH3wPgX6ohMS2wJXSeOBc4YE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043