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

Query time 0.00040