UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tv9nSnCJm4EZSeWPI1rwNuAa88ZOfVshhUvLPWLR7SQ='
WHERE
key_id = 'aacf5520c931978a3491a0603e2fb0389e3f3cd27c626e5db2e10447d523a648'
AND (
token = 'Tv9nSnCJm4EZSeWPI1rwNuAa88ZOfVshhUvLPWLR7SQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)