UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'snEPtyL7jVoEgwi1nsoy2QVjpVN/pIsOQM8sE+XAfdM=' 
WHERE 
  key_id = '59598ba82ad1a20d052d9eb733eb033639f6c00eda6432387852aa04952d96b4' 
  AND (
    token = 'snEPtyL7jVoEgwi1nsoy2QVjpVN/pIsOQM8sE+XAfdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042