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