UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C0YD+Uz/MQELPYvV11ksra2Gm+vIWpZU5DT8zO9hw/E=' 
WHERE 
  key_id = '571606883ce8db6d68decf70e63009965095cacfa27084709c1b539a0c621efb' 
  AND (
    token = 'C0YD+Uz/MQELPYvV11ksra2Gm+vIWpZU5DT8zO9hw/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029