UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z7v0RoatZA6jU47lKzXJ87FqLiqBxMA7vCC7ybObUis='
WHERE
key_id = '606447caee54ec8615d8f5ae37021dd97483604ecb31e1554c9a6771be5a01dc'
AND (
token = 'Z7v0RoatZA6jU47lKzXJ87FqLiqBxMA7vCC7ybObUis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)