UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAZwkrKj7aEQuE1548BLvNaFzqpuvQ5CFR+kcOZnlmU=' 
WHERE 
  key_id = '81c3a89321e3e42af2c831d6f29cf43219a49de8e2a4d7ed46498bc38d1eaa64' 
  AND (
    token = 'dAZwkrKj7aEQuE1548BLvNaFzqpuvQ5CFR+kcOZnlmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025