UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8civ40llOxh5Ghg14MjJqifZ699tWVoWU/8bzzNllpE=' 
WHERE 
  key_id = '97e53929229ce5cfd2aa999f11a85ea71e7793b83ac949675a00928916a029cc' 
  AND (
    token = '8civ40llOxh5Ghg14MjJqifZ699tWVoWU/8bzzNllpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048