UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4NWcwlaKgcgTHLXCfyMKpT2lX9JQ9LF3y/EeVChf0YM=' 
WHERE 
  key_id = '97b300abc3137c3de830cce069916704a083f257fee7731cdb33158f8f460b6e' 
  AND (
    token = '4NWcwlaKgcgTHLXCfyMKpT2lX9JQ9LF3y/EeVChf0YM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032