UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9cE3buPyGsseT3kzfLCfB8PqTGd0anXzVmszH+/dBtw='
WHERE
key_id = 'd6befa7d0ee795f2147c35d61f6c7f0ed9bfdd43c4ad770ca9171d920bcb2f3e'
AND (
token = '9cE3buPyGsseT3kzfLCfB8PqTGd0anXzVmszH+/dBtw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)