UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a8tM34pJ00TJ3slr+EZfpNximZel8pKzTYXV3C5E8Xg='
WHERE
key_id = '677b798329abf971ba56598581984aa54a70e17ec2123c2a0ab107959d39cce5'
AND (
token = 'a8tM34pJ00TJ3slr+EZfpNximZel8pKzTYXV3C5E8Xg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)