UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lSb4JBxhqxH44utDsW9sNOgc+UMl6794RX6NS9fv52g=' 
WHERE 
  key_id = '770a8fe0bee68fc2f84454ac7c1d7e6efaf017e3678c649084264923ef4be327' 
  AND (
    token = 'lSb4JBxhqxH44utDsW9sNOgc+UMl6794RX6NS9fv52g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043