UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KWsGaFt1gQLvbYkIUs8BUv6tdJMrU3TbKVJ9N+UEOqg=' 
WHERE 
  key_id = '81623c497c6d3ad9f1630fc7f9294e2e9ed9dd0c331eec006504f1b832b9fb43' 
  AND (
    token = 'KWsGaFt1gQLvbYkIUs8BUv6tdJMrU3TbKVJ9N+UEOqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050