UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w+w3DI7oUzULBL+JGObMWLGajLiQniZk57FlXmNTZbs=' 
WHERE 
  key_id = '2685c8360097de1166e5063abe9af0eb3099ce2b8c2ad844f9fd933ba9c84bfa' 
  AND (
    token = 'w+w3DI7oUzULBL+JGObMWLGajLiQniZk57FlXmNTZbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029