UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V0QHWhXXN3iu8petHJ5gFhDu8CZhhJsO+XPYIJg2dcc=' 
WHERE 
  key_id = '10ef582b1b235763b168e638b9e4082c5da2c5310257d92088da6fe966b07201' 
  AND (
    token = 'V0QHWhXXN3iu8petHJ5gFhDu8CZhhJsO+XPYIJg2dcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041