UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bfe6+8PX0BUasZUowfOcjhEQpM0J1sr6CoVwIIrKwj0='
WHERE
key_id = 'b8e045de13cb2d21749ecd6f7483091aaa44e090f1be3f5232a851748402c5d4'
AND (
token = 'Bfe6+8PX0BUasZUowfOcjhEQpM0J1sr6CoVwIIrKwj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)