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

Query time 0.00048