UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZp7g6OKDjfH+OiJDvV0y12T6672HiwEIWp60g5ayE0=' 
WHERE 
  key_id = 'b23055c08c735beaad1e194c5552edc241ac2b08ce1f84f9438cee047ceb91b7' 
  AND (
    token = 'XZp7g6OKDjfH+OiJDvV0y12T6672HiwEIWp60g5ayE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016