UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9CniPpS547D8tpywJWcOL2hGAZK3UXb6i7wy4TFAmRc=' 
WHERE 
  key_id = 'a038ff5a6246356b63d3ba29044451c80eb2e29ea9a011cc34046cad6ab2ca12' 
  AND (
    token = '9CniPpS547D8tpywJWcOL2hGAZK3UXb6i7wy4TFAmRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047