UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1SudcYWrA029SzBLvbZ0qeHABFo12qWy59RSz1P+u4A='
WHERE
key_id = '66c9c0e7ace719c7c293582c794c9958e0ca3d29f40b4af73109729a24d6e609'
AND (
token = '1SudcYWrA029SzBLvbZ0qeHABFo12qWy59RSz1P+u4A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)