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