UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gqk85mBffQkDnOlv0MgsEqKmKUkPMvCAl+lOHMK/x5g='
WHERE
key_id = 'ad5f02acedb2a654b2c30a1c09372233685dc2059f0ff1faf41a9f4b515aa652'
AND (
token = 'Gqk85mBffQkDnOlv0MgsEqKmKUkPMvCAl+lOHMK/x5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)