UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DELfjpuyVFtYQd3uSnuk0B9l4OU9oiTz7K8mHcSU9+U='
WHERE
key_id = 'cbaef7755be2a35193b78bceba45e56808245e2d4e55242171cfccd03c649064'
AND (
token = 'DELfjpuyVFtYQd3uSnuk0B9l4OU9oiTz7K8mHcSU9+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)