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