UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gk9yrOvoGLNY+sIk7/y9gb+cNE7jTCMxtMt7BdQZquM=' 
WHERE 
  key_id = '211d7049767f9be0eeaedd2002e26843a3f97cf827f60efcdf03cef7d4b6d629' 
  AND (
    token = 'Gk9yrOvoGLNY+sIk7/y9gb+cNE7jTCMxtMt7BdQZquM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037