UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZTjq8+WXwpHEJlO2PK3ZD8OhiHxDzO6batym7ZpCg6w=' 
WHERE 
  key_id = '243bf16fecc27064131a37d545397599d43c516e18ce56775845a9e502375996' 
  AND (
    token = 'ZTjq8+WXwpHEJlO2PK3ZD8OhiHxDzO6batym7ZpCg6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016