UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xf/gB3Umw3MywqNiuXLFjSFkKy2tZbmFiOd/T/kjTP4=' 
WHERE 
  key_id = '1a7abffbdc02e69af0abc37cc0f4ebf17e85025af940e64cde181fe24cf51503' 
  AND (
    token = 'xf/gB3Umw3MywqNiuXLFjSFkKy2tZbmFiOd/T/kjTP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039