UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yk2Q747FofvO5W+4ZkqfygUP9eGipJFLe4HBgbNmFss='
WHERE
key_id = '8aaba0553f0c3518a88ab7ff1f722e76d46578c7985efe937e78505112f13e39'
AND (
token = 'Yk2Q747FofvO5W+4ZkqfygUP9eGipJFLe4HBgbNmFss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)