UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rj4Ryi/fklaI3hYZVNXaHUt5Zsq5UtAOSgPP+3wlGLM=' 
WHERE 
  key_id = 'ea6ab997580036094c0715295483f58106e5f68cedb3b6fe05f9d9f4223c8336' 
  AND (
    token = 'rj4Ryi/fklaI3hYZVNXaHUt5Zsq5UtAOSgPP+3wlGLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028