UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGvRdDroyKTJE/nN16RGlOy5zSQwJL2xSM+teYgJI/U=' 
WHERE 
  key_id = '50ad9108c790bbd3bbc64a9e3eb0f0530472d51aeb8cf6d7d73e20c52a61e95d' 
  AND (
    token = 'HGvRdDroyKTJE/nN16RGlOy5zSQwJL2xSM+teYgJI/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034