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