UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T8QgpiuhSUV10ZFPSj67bbBQ/6/kuV0Y9PbJxMEn0Gc='
WHERE
key_id = 'a3579bc2a9da50138ecf896a9f6ab7ed33b3c9a88d0a2ed3ba13bf117d40b2db'
AND (
token = 'T8QgpiuhSUV10ZFPSj67bbBQ/6/kuV0Y9PbJxMEn0Gc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)