UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lF0ug9sX8GhqQiOMKAkWaeV6Ah6+w7E+01nqrjpev04='
WHERE
key_id = '96e87d8d3da77dcda4a7657f1d679903798091b45610880faec1473aa2ee77d0'
AND (
token = 'lF0ug9sX8GhqQiOMKAkWaeV6Ah6+w7E+01nqrjpev04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)