UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XBGY/taiX4GUPw+7x7UhUiJrla0EiaSwAUhamqeSjRE=' 
WHERE 
  key_id = '1ef7018afa932c9edba92bf136f5d5b77769da7cfc0710b5ec6f0a099c6d0fbe' 
  AND (
    token = 'XBGY/taiX4GUPw+7x7UhUiJrla0EiaSwAUhamqeSjRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054