UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2XxbJjrgsoG4rK8Q1bR+ZZjfbz7u3AZStdPjRcg7eCk=' 
WHERE 
  key_id = '1378af183ca9fe6826d9939e117e8c2f9080a82fb0f5444d14af8739be11e9df' 
  AND (
    token = '2XxbJjrgsoG4rK8Q1bR+ZZjfbz7u3AZStdPjRcg7eCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030