UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1pdUNOyrTSQ7gWW5xT1/nWSFC0ftOM6tJHbTzCGZ/Us=' 
WHERE 
  key_id = 'eb2165426d7b204d9db88ccc26fcbcc7ea072c960f2dc6abcdd5fd4b8817ca65' 
  AND (
    token = '1pdUNOyrTSQ7gWW5xT1/nWSFC0ftOM6tJHbTzCGZ/Us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023