UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wYaUWLG7zEQbL0OcmNPJlxybLYlcbHKWGzUCnf2g0eM=' 
WHERE 
  key_id = '390e22db20fe42d06a23c96416d0d8e9b6bddef7c5830994af0c4dec92020938' 
  AND (
    token = 'wYaUWLG7zEQbL0OcmNPJlxybLYlcbHKWGzUCnf2g0eM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068