UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZsTa6oTKDuvr+DJtzgzGmLKDO+f0ZCuVkPxkOdMHNCQ=' 
WHERE 
  key_id = 'b40e0f0c4d8aae53ca01338d0f3a371195748ff3d0d8bc3b74f9db8772307758' 
  AND (
    token = 'ZsTa6oTKDuvr+DJtzgzGmLKDO+f0ZCuVkPxkOdMHNCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076