UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'emST85XT5QTe4XMz29KG6JbGEHAM+0c0pb+gj/jYa/w='
WHERE
key_id = '378b9708ed1d2378138c33b17f579c62d0963900604d7bf22ac2c7c362630f28'
AND (
token = 'emST85XT5QTe4XMz29KG6JbGEHAM+0c0pb+gj/jYa/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)