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