UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xz6APC0mcBc9VxaUNgiJJuiaM2CRrv6D+KGwE+4VieI='
WHERE
key_id = 'd97a26ace28ccb630edcee936d77483315849be3cb49f583d32ea4f9f39e44c7'
AND (
token = 'xz6APC0mcBc9VxaUNgiJJuiaM2CRrv6D+KGwE+4VieI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)