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

Query time 0.00031