UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Dd9DzOcFVGg7mP6JEzl8dicSyVDo5uv/ywcUs8GMew4='
WHERE
key_id = 'b888430b40f6d965b7830b2a485186d4fe6bcc5d8dcd9acafa84d8a7f1301f2e'
AND (
token = 'Dd9DzOcFVGg7mP6JEzl8dicSyVDo5uv/ywcUs8GMew4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)