UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zny1RwJsByzKPswQvOxmgtsK9T7rZqtKdemsJwBphRw='
WHERE
key_id = '8fd6688559623d0dc0f4a29c1163f74f439659401b9480d78da65f633f74bb71'
AND (
token = 'Zny1RwJsByzKPswQvOxmgtsK9T7rZqtKdemsJwBphRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)