UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gotaC9VEAJBWqvo3VZuRC40pxB+hWjvtl9PRTAaOawU=' 
WHERE 
  key_id = '25c80712ef105057097cbd3eb30de5acfac2d0401169afef14ba751e2b30cecd' 
  AND (
    token = 'gotaC9VEAJBWqvo3VZuRC40pxB+hWjvtl9PRTAaOawU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020