UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+E4JkNEhU4/CxSO+7dz46sb6Bm/hyx319BCmfsmLw2Y='
WHERE
key_id = 'd71e94019c52eef496456a5fc7f657982e31f48db04bf477c0339855d0ebeb71'
AND (
token = '+E4JkNEhU4/CxSO+7dz46sb6Bm/hyx319BCmfsmLw2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)