UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9xqMchijqbOo24ieoEMZTuhlMsAvQH4tDP9ihYUii54='
WHERE
key_id = 'a5417b227c9c07abf5aac9441c7f080fe61ec02fc54fd4a70b329ef7afff104c'
AND (
token = '9xqMchijqbOo24ieoEMZTuhlMsAvQH4tDP9ihYUii54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)