UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E9VgBiVBYRTKwPLUJ53yDkDxs//h40Iuw0QF/WO6v1s=' 
WHERE 
  key_id = '5713d3b40714b2af80e82f81a8a1940a9e610093bc1f7e27808f9076e2aa6a4e' 
  AND (
    token = 'E9VgBiVBYRTKwPLUJ53yDkDxs//h40Iuw0QF/WO6v1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038