UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clWXWqjscCO4AviUi3C5LG/SEBpzrAz5YqE5jaK6XZU=' 
WHERE 
  key_id = '311d040fb97fff73a063159d30b11e52fc57605b91372ef329c691f29860149e' 
  AND (
    token = 'clWXWqjscCO4AviUi3C5LG/SEBpzrAz5YqE5jaK6XZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030