UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lUF9sHzpwbzeHFlkiwy6MVDJeog9Oj/bvrkTNcAbv/k=' 
WHERE 
  key_id = '3c0ee9d38eaa18268b75939cc335d826719055390cf39e9a3720e22508e79918' 
  AND (
    token = 'lUF9sHzpwbzeHFlkiwy6MVDJeog9Oj/bvrkTNcAbv/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035