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