UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/Ku9yBjPoJFtwXnCp7QfyW3OJ/UjyoyHNWGkBrLsIo=' 
WHERE 
  key_id = '61724c6e7054b1d50052a8312347053e987c97861c92ad70935862d78b6f2812' 
  AND (
    token = 'P/Ku9yBjPoJFtwXnCp7QfyW3OJ/UjyoyHNWGkBrLsIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036