UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5DWzOwoxdQk87z5hSuCx29TmjJwO/cvvafijd4y+QX8=' 
WHERE 
  key_id = '59601c2da11c7fc27375f8892d6ff3e11fba7c661f7228856f60eb30401ad10b' 
  AND (
    token = '5DWzOwoxdQk87z5hSuCx29TmjJwO/cvvafijd4y+QX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046