UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9O1VYwYpzqOpZItRFSHXK2/YVeNJRICjosBLqEpz41M=' 
WHERE 
  key_id = 'd0bb18c55a2be9c4d8a578610eb46cecf4c40249a356aafb6ad3af898a43b860' 
  AND (
    token = '9O1VYwYpzqOpZItRFSHXK2/YVeNJRICjosBLqEpz41M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040