UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XSIzfVyNanv63sDnKGH6hcBsGlzaFSWpYE/jk2CnUUI=' 
WHERE 
  key_id = '6779a9a0ea65bf0069c580b067d86df67210f68dcdc87cd642535a045fc13a88' 
  AND (
    token = 'XSIzfVyNanv63sDnKGH6hcBsGlzaFSWpYE/jk2CnUUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035